<template>
  <tm-sheet :padding="[0]" :margin="[0, 20]">
    <tm-grid :width="750" :col="4">
      <tm-grid-item
        :height="150"
        v-for="(item, index) in props.relationData.info"
        :key="index"
        @click="menuClick(item)"
      >
        <tm-icon
          :name="item.infoIcon"
          :font-size="40"
          color="#366Ef4"
        ></tm-icon>
        <tm-text
          _class="pt-10"
          :font-size="26"
          color="#6f7686"
          :label="item.infoTitle"
        ></tm-text>
      </tm-grid-item>
    </tm-grid>
  </tm-sheet>
  <formModal
    :show="show"
    @close="close"
    @confirm="confirm"
    :className="'center'"
    :menuInfo="menuInfo!"
  />
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import { IPortal, InfoPortal } from '@/pages/home/common/portalType'
import formModal from '../../../components/customModal/formModal.vue'
type Props = {
  relationData: IPortal
}
const props = defineProps<Props>()
let show = ref<boolean>(false)
let menuInfo = ref<InfoPortal>()
const menuClick = (info: InfoPortal) => {
  menuInfo.value = info
  openModal()
}
/** 打开弹窗 */
const openModal = () => {
  show.value = true
}

const close = () => {
  show.value = false
}

const confirm = async () => {
  // if (val.submitType === 'search') {
  //   if (val?.result.values) {
  //     const result = await orgCtrl.user.applyJoin(val?.result.values)
  //     if (result) {
  //       uni.showToast({
  //         title: '申请成功',
  //         icon: 'none'
  //       })
  //     }
  //   }
  // } else {
  //   const res = await orgCtrl.user.createTarget(val.result)
  //   if (res) {
  //     uni.showToast({
  //       title: '创建成功',
  //       icon: 'none'
  //     })
  //   }
  // }
  // show.value = false
}
</script>

<style scoped></style>
